package zt

import "encoding/json"

// Unset4Slice 删除数组中指定的key
func Unset4Slice(arrJson []byte, keys []string) []map[string]interface{} {
	var result []map[string]interface{}
	//logs.Info(string(arrJson))
	json.Unmarshal(arrJson, &result)
	//logs.Info(result)
	for _, v := range result {
		for _, kv := range keys {
			delete(v, kv)
		}
	}
	//logs.Info(result)
	return result
}

// Unset4Obj 删除单对象中的key
func Unset4Obj(obj []byte, keys []string) map[string]interface{} {
	resultJson, _ := json.Marshal(obj)
	var result map[string]interface{}
	json.Unmarshal(resultJson, &result)
	for _, kv := range keys {
		delete(result, kv)
	}
	return result
}
